<?php

/**
 * Main configuration.
 * All properties can be overridden in mode_<mode>.php files
 */
return array(
	'yiiSetPathOfAlias'=>array(),
	'configWeb'=>array(
		'basePath'=>dirname(__FILE__) . DIRECTORY_SEPARATOR . '..',
		'name'=>'Hayate\'s Corner',
		'preload'=>array('log'),
		'theme'=>'classic',
		'import'=>array(
			'application.models.*',
			'application.helpers.*',
			'application.components.*',
			'application.extensions.*',
			'application.modules.user.models.*',
			'application.modules.user.components.*',
			'ext.restfullyii.components.*',
		),
		'behaviors'=>array(
			'ApplicationBehavior',
			'layout'=>'LayoutBehavior',
		),
		'modules'=>array(
			'user'=>array(
				'returnLogoutUrl'=>array('/site/index'),
				'returnUrl'=>array('/site/index'),
				'sendActivationMail'=>true,
			)
		),
		'components'=>array(
			'user'=>array(
				'allowAutoLogin'=>true,
				'loginUrl'=>array('/user/login'),
				'class'=>'WebUser',
			),
			'image'=>array(
				'class'=>'application.extensions.image.CImageComponent',
				'driver'=>'GD',
			),
			'authManager'=>array(
				'class'=>'CDbAuthManager',
				'connectionID'=>'db',
				'itemTable'=>'auths',
				'itemChildTable'=>'auth_childs',
				'assignmentTable'=>'auth_assignments',
			),
			'urlManager'=>array(
				'urlFormat'=>'path',
				'showScriptName'=>false,
				'urlSuffix'=>'.html',
				'rules'=>array(
					'api/<controller:\w+>'=>array(
						'<controller>/restList',
						'verb'=>'GET'
					),
					'api/<controller:\w+>/<id:\w+>'=>array(
						'<controller>/restView',
						'verb'=>'GET'
					),
					'api/<controller:\w+>/<id:\w+>/<var:\w+>'=>array(
						'<controller>/restView',
						'verb'=>'GET'
					),
					array(
						'<controller>/restUpdate',
						'pattern'=>'api/<controller:\w+>/<id:\d+>',
						'verb'=>'PUT'
					),
					array(
						'<controller>/restDelete',
						'pattern'=>'api/<controller:\w+>/<id:\d+>',
						'verb'=>'DELETE'
					),
					array(
						'<controller>/restCreate',
						'pattern'=>'api/<controller:\w+>',
						'verb'=>'POST'
					),
					array(
						'<controller>/restCreate',
						'pattern'=>'api/<controller:\w+>/<id:\w+>',
						'verb'=>'POST'
					),
					'<controller:\w+>/<id:\d+>'=>'<controller>/view',
					'<controller:\w+>/<action:\w+>/<id:\d+>'=>
					'<controller>/<action>',
					'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
				),
			),
			'errorHandler'=>array(
				'errorAction'=>'site/error',
			),
		),
	),
	'configConsole'=>array(
		'basePath'=>dirname(__FILE__) . DIRECTORY_SEPARATOR . '..',
		'name'=>'Hayate',
		'preload'=>array('log'),
		'import'=>'inherit',
		'components'=>array(
			'db'=>'inherit',
			'authManager'=>'inherit',
			'log'=>array(
				'class'=>'CLogRouter',
				'routes'=>array(
					array(
						'class'=>'CFileLogRoute',
						'levels'=>'error, warning, trace, info',
					),
				),
			),
		),
	),
);